package com.meizhuang.entity.enums;

import lombok.*;
import org.apache.commons.lang.StringUtils;


public enum OrderStatusEnum {

    INIT("INIT", 0),  //初始化
    SUCCESS("SUCCESS", 1),    //：支付成功
    REFUND("REFUND", 2),     //转入退款
    NOTPAY("NOTPAY", 3),     //未支付
    CLOSED("CLOSED", 4),     //已关闭
    REVOKED("REVOKED", 5),    //已撤销（付款码支付）
    USERPAYING("USERPAYING", 6), //用户支付中（付款码支付）
    PAYERROR("PAYERROR", 7);   //支付失败(其他原因，如银行

    @Getter
    @Setter
    private String name;
    @Getter
    @Setter
    private Integer value;

    OrderStatusEnum(String name, Integer value) {
        this.name = name;
        this.value = value;
    }


    public static OrderStatusEnum getOrderStatusName(String name) {

        final OrderStatusEnum[] values = OrderStatusEnum.values();

        for (OrderStatusEnum orderStatusEnum : values) {
            if (orderStatusEnum.name().equals(name)) {
                return orderStatusEnum;
            }
        }

        return INIT;
    }


}

